// 版权归陈超所有

#pragma once

#include "CoreMinimal.h"
#include "UObject/NoExportTypes.h"
#include "CC_WidgetController.generated.h"


class UAttributeSet;
class UAbilitySystemComponent;

//结构体
USTRUCT(BlueprintType)
struct FWidgetControllerParams
{
	GENERATED_BODY()
	//构造函数
	FWidgetControllerParams(){}
	
	FWidgetControllerParams(APlayerController* PC, APlayerState* PS, UAbilitySystemComponent* ASC, UAttributeSet* AS)
	:PlayerController(PC), PlayerState(PS), AbilitySystemComponent(ASC), AttributeSet(AS) {}		

	//变量
	UPROPERTY(BlueprintReadOnly, Category="WidgetController")
	TObjectPtr<APlayerController> PlayerController = nullptr;
	UPROPERTY(BlueprintReadOnly, Category="WidgetController")
	TObjectPtr<APlayerState> PlayerState= nullptr;
	UPROPERTY(BlueprintReadOnly, Category="WidgetController")
	TObjectPtr<UAbilitySystemComponent> AbilitySystemComponent= nullptr;
	UPROPERTY(BlueprintReadOnly, Category="WidgetController")
	TObjectPtr<UAttributeSet> AttributeSet= nullptr;
};


/**
 * 
 */
UCLASS()
class CC_AURA_API UCC_WidgetController : public UObject
{
	GENERATED_BODY()
public:
	// 控制器层类增加一个蓝图可调用函数，通过蓝图调用去设置控制器层的相关参数。
	UFUNCTION(BlueprintCallable)
	void SetWidgetControllerParams(const FWidgetControllerParams& WCParams);

	//广播初始值
	virtual void BroadcastInitialValues();

	//依赖的绑定回调函数
	virtual void BindCallbacksToDependencies();
	
protected:
	// 需要去获取model层的数据。数据在在角色的playerController，playerState，AbilitySystemComponent和AttributeSet身上。
	UPROPERTY(BlueprintReadOnly, Category="WidgetController")
	TObjectPtr<APlayerController> PlayerController;
	UPROPERTY(BlueprintReadOnly, Category="WidgetController")
	TObjectPtr<APlayerState> PlayerState;
	UPROPERTY(BlueprintReadOnly, Category="WidgetController")
	TObjectPtr<UAbilitySystemComponent> AbilitySystemComponent;
	UPROPERTY(BlueprintReadOnly, Category="WidgetController")
	TObjectPtr<UAttributeSet> AttributeSet;
	
};
